package ExceptionThrow;

public class Test2 {
    //声明异常不是只能声明受查异常，也可以声明非受查异常
    public static void test(int a)
            throws NullPointerException, ArithmeticException, ArrayIndexOutOfBoundsException, CloneNotSupportedException {
        if(a == 10){
            throw new CloneNotSupportedException();//受查异常 必须此时处理
            //throw new NullPointerException();
        }
    }

    public static void main(String[] args) {
        try {
            test(10);
        } catch (CloneNotSupportedException e) {
            //throw new RuntimeException(e);
            e.printStackTrace();
        }
    }
}
